<?php

namespace app\model;

use app\BaseModel;
use think\model\relation\BelongsTo;
use app\model\not_del\UserModel as NotDelUserModel;

/**
 * 心理咨询-线上咨询
 */
class ConsultOnlineModel extends BaseModel
{
    protected $name = 'consult_online';


    /**
     * 关联咨询用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(NotDelUserModel::class, 'uid')->bind([
            'user_name' => 'name',
            'user_avatar' => 'avatar',
            'department_id',
            'department_name'
        ]);
    }

    /**
     * 关联咨询师
     * @return BelongsTo
     */
    public function consult(): BelongsTo
    {
        return $this->belongsTo(NotDelUserModel::class, 'consult_id')->bind([
            'consult_name' => 'name',
            'consult_avatar' => 'avatar',
            'consult_online_num',
            'consult_offline_num',
            'consult_age' => 'age',
            'consult_sex' => 'sex',
        ]);
    }

    /**
     * 关联咨询问题类型
     * @return BelongsTo
     */
    public function questionName(): BelongsTo
    {
        return $this->belongsTo('ConsultQuestionModel', 'question_id')->bind([
            'question_name' => 'name',
        ]);
    }
}